#ifndef _DevicesSPI_H_
#define _DevicesSPI_H_


#define SPI0_NSS_SET_HIGH()                 gpio_bit_set(GPIOA, GPIO_PIN_8)
#define SPI0_NSS_SET_LOW()                  gpio_bit_reset(GPIOA, GPIO_PIN_8)


void vSPI0Init(void);

#define ucSPI0WriteReadByte(ucByte)         ucSPIWriteReadByte(SPI0, (ucByte))
#define cSPI0WriteDatas(pBuffer, iLength)   cSPIWriteDatas(SPI0, (pBuffer), (iLength))
#define cSPI0ReadDatas(pBuffer, iLength)    cSPIReadDatas(SPI0, (pBuffer), (iLength))

#define ucSPI1WriteReadByte(ucByte)         ucSPIWriteReadByte(SPI1, (ucByte))
#define cSPI1WriteDatas(pBuffer, iLength)   cSPIWriteDatas(SPI1, (pBuffer), (iLength))
#define cSPI1ReadDatas(pBuffer, iLength)    cSPIReadDatas(SPI1, (pBuffer), (iLength))

#define ucSPI2WriteReadByte(ucByte)         ucSPIWriteReadByte(SPI2, (ucByte))
#define cSPI2WriteDatas(pBuffer, iLength)   cSPIWriteDatas(SPI2, (pBuffer), (iLength))
#define cSPI2ReadDatas(pBuffer, iLength)    cSPIReadDatas(SPI2, (pBuffer), (iLength))

uint8_t ucSPIWriteReadByte(uint32_t uiSpiPeriph, uint8_t ucByte);
int8_t cSPIWriteDatas(uint32_t uiSpiPeriph, void *pvBuff, int32_t iLength);
int8_t cSPIReadDatas(uint32_t uiSpiPeriph, void *pvBuff, int32_t iLength);


#endif
